package com.shu.pattern;

/**
 * @author ssm
 * @version V1.0
 * @description:
 * @date 2021/8/18 17:51
 */

public class TemplateMethodPattern {


    public static void main(String[] args) {

        Cook ZC = new Cook(){

            @Override
            protected void step1() {
                System.out.println("洗菜");
            }

            @Override
            protected void step2() {
                System.out.println("烹饪");
            }
        };
        ZC.doCook();
    }
}


abstract class Cook {

    protected void step0() {
        System.out.println("开始cook");
    }

    protected abstract void step1();

    protected abstract void step2();

    public void doCook() {
        step0();
        step1();
        step2();
    }

}